import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Test {
    public static void main(String[] args) throws SQLException {
        DataSource dataSource=new MysqlDataSource();
        ((MysqlDataSource)dataSource).setUrl("jdbc:mysql://127.0.0.1:3306/test");
        ((MysqlDataSource)dataSource).setPassword("123456");
        ((MysqlDataSource)dataSource).setUser("root");


        Connection connection=dataSource.getConnection();


        //写一个sql
        String sql="insert into student values(1,'zz')";
        PreparedStatement preparedStatement=connection.prepareStatement(sql);



    }
}
